<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@page import="com.globalresources.commons.Constant" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@page import="java.util.List"%>
<%
  String str_targetURL = application.getInitParameter("TARGET_URL");
  String str_signatureType = application.getInitParameter("SIGNATURE_TYPE");
  String str_signatureMechanism = application.getInitParameter("SIGNATURE_MECHANISM");
  String str_contentSource = application.getInitParameter("CONTENT_SOURCE");
  String str_resultPage = application.getInitParameter("RESULT_PAGE");
  String str_errorPage = application.getInitParameter("ERROR_PAGE");
  String str_rootFolderUrl = application.getInitParameter("ROOT_FOLDER_URL"); 
  String str_outputPDF = (String) request.getParameter("str_documentId");  
  String str_pdfPath = str_outputPDF; 
  System.out.println(str_outputPDF);   
  int i_indexPos = str_resultPage.lastIndexOf("/");
  String str_filesDownloadingBasePath = str_resultPage.substring(0, i_indexPos + 1);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Zero Footprint</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="../GoSign/lib/gosign.js"></script>
<link href="style_sheet.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<center>
<form name="mainForm">
  <input type="hidden" name="hdn_targetPDF" value="<%=str_outputPDF%>"/>
  <table width="925" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
      <td width="13" height="10"></td>
      <td width="973"></td>
      <td width="13"></td>
    </tr>
    <tr>
      <td height="654"></td>
      <td valign="top">
        <table width="931" height="649" border="0" cellpadding="3" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="925" height="649" colspan="2" align="center" valign="top">
            <table width="900" border="0" cellpadding="0" cellspacing="0">
                <!--DWLayoutTable-->
                <tr>
                  <td width="225" height="592">
                  <td width="958" height="592">
           			 <iframe height="600" width="1100" id="pdf-frame" src="<%=str_pdfPath %>">This page requires a browser that will support in-line frames.</iframe>
                  </td>
                </tr>
               
              </table>
            </td>
          </tr>
        </table>
      </td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="2">
        <img src="images.gif" alt="" width="40" height="1">
      </td>
      <td colspan="2">
        <img src="images.gif" alt="" width="565" height="1">
      </td>
    </tr>
  </table>
</form>
<script type="text/javascript">
	// Embedding GoSign applet on the web page
	GoSign_EmbedApplet('<%=str_rootFolderUrl%>', '<%=str_signatureType%>', '<%=str_signatureMechanism%>', '<%=str_contentSource%>');
</script>  <p>&nbsp;</p>
</center>
</body>
</html>
<script type="text/javascript">
	function init() {
		var b_available = GoSign_IsAvailable();
		if( b_available == true ){
			GoSign_SetAliasDisplayTemplate(GoSign_Constants.SUBJECT_CN+","+GoSign_Constants.ISSUER_O);
			GoSign_SetAliasDisplayValueMissing("Not Applicable");
			//Form name can be set by un-commenting the below statement.
			//GoSign_SetFormName('mainForm');
                if( GoSign_SetFilterCriteria(GoSign_Constants.SHOW_EXPIRED_CERTIFICATES, GoSign_Constants.FALSE) != true){
				alert(GoSign_GetErrorReason());
				document.location.href = "introduction.htm";
                                return;
			}
			if( GoSign_ShowCertificates() != true){
				alert(GoSign_GetErrorReason());
				document.location.href = "introduction.htm";
                return;
			}
                        GoSign_SetResultPage('<%=str_resultPage%>');
                        GoSign_SetTargetURL('<%=str_targetURL%>');
		}
        else{
                  alert(GoSign_GetErrorReason());
                  document.location.href = "introduction.htm";
            }
	}
	function CheckSignDocReq(){
		if(GoSign_SignDocument() != true){
			alert(GoSign_GetErrorReason());
			if(GoSign_GetErrorCode() == 1011){
				return;
			}
		}
	}
	window.onload = init;
</script>

